<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="favicon.ico">  <link href="__STATIC__/layout/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__STATIC__/layout/css/font-awesome.css?v=4.4.0" rel="stylesheet">
     <link href="__STATIC__/layout/css/plugins/summernote/summernote.css" rel="stylesheet">
    <link href="__STATIC__/layout/css/plugins/summernote/summernote-bs3.css" rel="stylesheet">
     <link rel="stylesheet" type="text/css" href="__STATIC__/layout/css/plugins/webuploader/webuploader.css">
    <link rel="stylesheet" type="text/css" href="__STATIC__/layout/css/demo/webuploader-demo.css">
    <!-- jqgrid-->
    <link href="__STATIC__/layout/css/animate.css" rel="stylesheet">
    <link href="__STATIC__/layout/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="__STATIC__/layout/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="__STATIC__/layout/css/gyq.css" rel="stylesheet">
    <link rel="stylesheet" href="__STATIC__/layout/css/demo.css" type="text/css">
     <script src="__STATIC__/layout/js/jquery.min.js?v=2.1.4"></script>
    <script src="__STATIC__/sc/js/page.js"></script> 
</head>

<body style="color:#333;padding:3px;">
    <!-- 标题 -->
    <div class="page-heade">
      <h2 class="title_color text-center">AP费用核销 </h2>
    </div>
    <!-- 标题 -->
    <div class="form-inline">
     <form action="#" method="post" id="form_check" class="formpage">
      <input type="hidden" value='{$page}' name="page" id="page-go"/>
                      <input type="hidden" value='{$list}' name="list" id="list-go"/>
      <table class="row-margin-top tab-content table-bordered table text-center" border="1">
       <tr>
            
          </tr>
         <tr>
                <td><label for="" class="form-label">编号：</label><input type="text" class="form-control" name="no" value="{$data.no}"></td>
                <td><label for="">主题：</label><input type="text" class="form-control" name="title" value="{$data.title}"></td>
                <td><label for="">状态：</label>
                    <select name="state" id="state" class="form-control" style="min-width: 100px;width: 100px">
                        <option value="0">请选择</option>
                        {volist name="states" id="sta"}
                        {if condition="$data.state eq $sta.id"}
                        <option value="{$sta.id}" selected>{$sta.title}</option>
                        {else/}
                        <option value="{$sta.id}">{$sta.title}</option>
                        {/if}
                        {/volist}
                    </select></td>
                <td>
                    <div class="form-group">
                        申请时间
                    </div>
                    <div class="form-group">
                        <input type="text" id="start" placeholder="开始日期" class="form-control layer-date "
                               style="min-width:100px;height: 22px;display: inline-block;" name="start" value="{$data.start}">
                    </div>
                    <div class="form-group">
                        至
                    </div>
                    <div class="form-group">
                        <input type="text" class="form-control layer-date" placeholder="结束日期"
                               style="min-width:100px;height: 22px;display: inline-block;" id="end" name="end" value="{$data.end}">
                    </div>
                </td>
                <td>
                    <button class="btn btn-info query" type="button" id="check">查询</button>
                    <button class="btn btn-info emptyIf" type="button" id="clear_check">清空查询条件</button>
                </td>
            </tr>
      </table>
    
      <table class="table table-striped row-margin-top table-bordered text-center bud_hei">
          <tr class="info text-center">
            <th class="text-center">NO.</th>
            <th class="text-center">编号</th>
            <th class="text-center">主题</th>
            <th class="text-center">含税核销金额(元)</th>
            <th class="text-center">是否已支付</th>
            <th class="text-center">已支付金额(元)</th>
            <th class="text-center">状态</th>
            <th class="text-center">申请人</th>
            <th class="text-center">申请时间</th>
            <th class="text-center">操作</th>
          </tr>
          {volist name="applyde" id="vo"}
            <tr class=" text-center">
                <td>{$i}</td>
                <td><a onclick="hede({$vo.id},{$vo.apid})">{$vo.no}</a></td>
                <td>{$vo.title}</td> 
                <td class="num2">{$vo.hanshui}</td> 
                <td>{if condition="$vo.is_fukuan eq 1"}是{else/}否{/if}</td>
                <td class="num2">{$vo.zhifu}</td> 
                <td>{$vo.state_name}</td> <td>{$vo.cname}</td><td>{$vo.created_on}</td>
                <td>
                     {switch name="$vo.state" }

                        {case value="1"}
                                <!--草稿-->
                            <a onclick="tijiao({$vo.id})">提交工作流</a>
                            <a href="{:url('hxxiugai')}?hid={$vo.id}">修改</a>
                            <a onclick="shanchu({$vo.id})">删除</a>
                             
                        {/case}
                         {case value="2"}
                            <a href="{:url('hxxiugai')}?hid={$vo.id}">作废/修改</a>
                           <a href="{:url('Workflowdb/workflowchart',['id'=>$vo.myId])}" class="J_menuItem" title="查看流程图">查看流程图</a>
                         {/case}
                         {default/}  <a href="{:url('Workflowdb/workflowchart',['id'=>$vo.myId])}" class="J_menuItem" title="查看流程图">查看流程图</a>
                     {/switch}
                </td>
            </tr>
          {/volist}
      </table>
       <h5 class="text-center" id="pagesc" style="font-size: 16px;font-weight: 500">
            <script>
                            $(function(){
                                pageSC("pagesc",{$sum},{$page},{$maxpage})
                            })
                        </script> 
                        每页显示
           <select id="pagesize">
                        <option value='10' {if condition="$list eq 10"}selected{/if}>10条</option>
                        <option value='20'{if condition="$list eq 20"}selected{/if}>20条</option>
                        <option value='40'{if condition="$list eq 40"}selected{/if}>40条</option>

            </select>
        </h5>

</form>
    </div>
    <!-- 全局js -->
   <!-- 全局js -->
    <script src="__STATIC__/layout/js/bootstrap.min.js?v=3.3.6"></script>
    <!-- <script src="js/plugins/metisMenu/jquery.metisMenu.js"></script> -->
    <script src="__STATIC__/layout/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
   <script src="__STATIC__/layout/js/plugins/layer/laydate/laydate.js"></script>
     <script src="__STATIC__/layout/js/plugins/sweetalert/sweetalert.min.js"></script>
         <script src="__STATIC__/layout/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="__STATIC__/layout/js/plugins/summernote/summernote.min.js"></script>
<script src="__STATIC__/layout/js/plugins/summernote/summernote-zh-CN.js"></script>
<script src="__STATIC__/layout/js/plugins/suggest/bootstrap-suggest.min.js"></script>
 <script src="__STATIC__/layout/js/common.js"></script>
  <script src="__STATIC__/layout/js/plugins/layer/layer.min.js"></script>
  <script src="__STATIC__/layout/js/contabs_sub.js"></script>
    <script>
    //翻页
     
        $("#check").click(function(){
              $("#page-go").val(1);
              $(".formpage").submit();
        })
        $("#clear_check").click(function(){
            $("input[type='text']").val("");
            $("select").val(0);
            $("#page-go").val(1);
            $(".formpage").submit();
        })
        function shanchu(id){
            if(confirm('您确定要删除这份申请么？')){
                 $.post("{:url('hxshanchu')}",{id:id},function(re){
        //alert(re);
                        var data=JSON.parse(re);
                            if(data["state"]==1){

                                        swal({
                                                title: "完成",
                                                text: "操作已成功",
                                                type: "success"
                                                },function(){
                                                   document.getElementById("form_check").submit();
                                                  //
                                                });
                               
                                
                            }else{
                                 swal({
                                                title: "错误",
                                                text: data["msg"],
                                                type: "warning"
                                                });
                            }
                      })
            }
        }
    //提交工作流
function tijiao(id){
    swal({
      title: "您确定嘛?",
      text: "提交后将不能撤销，请核对完相关内容",
      type: "warning",
      showCancelButton: true,
      confirmButtonColor: "#DD6B55",
      confirmButtonText: "确定",
      cancelButtonText: "取消",
      closeOnConfirm: false
    },
    function(){
      $.post("{:url('hxtijiao')}",{id:id},function(re){
        //alert(re);
        var data=JSON.parse(re);
            if(data["state"]==1){

                        swal({
                                title: "完成",
                                text: "操作已成功",
                                type: "success"
                                },function(){
                                   document.getElementById("form_check").submit();
                                  //
                                });
               
                
            }else{
                 swal({
                                title: "错误",
                                text: data["msg"],
                                type: "warning"
                                });
            }
      })
    });
}
function hede(hid,aid){
    var index = layer.open({
                            type:2,
                            title:'常规促销申请',
                            area:['100%','100%'],
                            maxmin:true,
                            content:'{:url("apCostVerifyDetail")}?aid='+aid+"&hid="+hid
                        })
}
        //日期范围限制
        var start = {
            elem: '#start',
            format: 'YYYY/MM/DD',
            min: laydate.now(), //设定最小日期为当前日期
            max: '2099-06-16 23:59:59', //最大日期
            istime: true,
            istoday: false,
            choose: function (datas) {
                end.min = datas; //开始日选好后，重置结束日的最小日期
                end.start = datas //将结束日的初始值设定为开始日
            }
        };
        var end = {
            elem: '#end',
            format: 'YYYY/MM/DD',
            min: laydate.now(),
            max: '2099-06-16 23:59:59',
            istime: true,
            istoday: false,
            choose: function (datas) {
                start.max = datas; //结束日选好后，重置开始日的最大日期
            }
        };
        laydate(start);
        laydate(end);
    </script>
</body>

</html>
